import request from '@/utils/request.js'

const config = {
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
}

// 登录
export const login = (username, password) => {
    const data = { username, password }
    return request.post('/login', data, config)
    /*
    return request({
        url: '/login',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        method: 'post',
        data: data
    })
    */
}

// 获取用户信息
export const getUser = async () => {
  return await request.get('/user')
}

export const logout = () => {
  return request.post('/logout')
}
